package com.xpec.c4.game.time;

import com.xpec.c4.game.time.listener.TimeListenerManager;

public class TimeSys {

	public static TimeSys instance = new TimeSys();

	private static long timeInterval = 0;

	public static long currentTimeMills() {
		return System.currentTimeMillis() + timeInterval;
	}
	
	public static long currentTimeSec()
	{
		return (System.currentTimeMillis() + timeInterval)/1000;
	}
	
	public static void modifyTime(long newTime) {
		resetTime(newTime - System.currentTimeMillis());
	}

	public static void resetTime(long newTimeInterval) {
		timeInterval = newTimeInterval;
		
		// 监听时间修改
		TimeListenerManager.getInstance().processTimeChanged();
	}
}
